Description: "make install": Support DESTDIR, use symlink for
lgrep, use more standard default permissions (and make them
variables). Create bin/man/lib dirs if they don't already exist.
Author: B. Watson <yahlcru@gmail.com>

--

diff -Naur lv-4.51.orig/src/Makefile.in lv-4.51.orig.patched/src/Makefile.in
--- lv-4.51.orig/src/Makefile.in	2004-01-06 02:22:17.000000000 -0500
+++ lv-4.51.orig.patched/src/Makefile.in	2020-11-12 01:59:50.646022314 -0500
@@ -18,6 +18,10 @@
 lvlibdir=	$(libdir)/lv
 distdir = lv$(VERSION)
 
+DESTDIR=
+BINPERMS= 0755
+DOCPERMS= 0644
+
 PURIFY=	@PURIFY@
 CC=	@CC@
 CFLAGS=	@CFLAGS@ -DLV_HELP_PATH=\"$(lvlibdir)\" -I$(srcdir) @DEFS@
@@ -64,18 +68,22 @@
 #
 
 install::
-	$(INSTALL) -s -m 555 lv $(bindir)
-	if test -f $(bindir)/lgrep; then \
-		/bin/rm -f $(bindir)/lgrep; \
+	if test ! -d $(DESTDIR)$(bindir); then \
+		mkdir -p $(DESTDIR)$(bindir); \
+	fi
+	$(INSTALL) -s -m $(BINPERMS) lv $(DESTDIR)$(bindir)
+	if test -f $(DESTDIR)$(bindir)/lgrep; then \
+		/bin/rm -f $(DESTDIR)$(bindir)/lgrep; \
 	fi
-	(cd $(bindir); ln lv lgrep)
-	if test ! -d $(lvlibdir); then \
-		mkdir -p $(lvlibdir); \
+	(cd $(DESTDIR)$(bindir); ln -s lv lgrep)
+	if test ! -d $(DESTDIR)$(lvlibdir); then \
+		mkdir -p $(DESTDIR)$(lvlibdir); \
 	fi
-	$(INSTALL) -m 444 $(srcdir)/../lv.hlp $(lvlibdir)
-	if test -d $(mandir) -a -d $(mandir)/man1; then \
-		$(INSTALL) -m 444 $(srcdir)/../lv.1 $(mandir)/man1; \
+	$(INSTALL) -m $(DOCPERMS) $(srcdir)/../lv.hlp $(DESTDIR)$(lvlibdir)
+	if test ! -d $(DESTDIR)$(mandir)/man1; then \
+		mkdir -p $(DESTDIR)$(mandir)/man1; \
 	fi
+	$(INSTALL) -m $(DOCPERMS) $(srcdir)/../lv.1 $(DESTDIR)$(mandir)/man1; \
 
 uninstall::
 	for i in $(bindir)/lv $(bindir)/lgrep $(lvlibdir)/lv.hlp $(mandir)/man1/lv.1; do \
